/*
'===============================================================================
'  Generated From - CSharp_EasyObject_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL      = SQL_DAAB_StoredProcs.vbgen
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easily done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.Common;
using System.Configuration;
using System.Collections;
using System.Collections.Specialized;
using System.Xml;
using System.IO;

using Microsoft.Practices.EnterpriseLibrary.Data;
using NCI.EasyObjects;

namespace CMS.DAL
{

	#region Schema

	public class BasketSchema : NCI.EasyObjects.Schema
	{
		private static ArrayList _entries;
		public static SchemaItem BasketID = new SchemaItem("BasketID", DbType.Int32, true, false, false, true, false, false);
		public static SchemaItem BasketName = new SchemaItem("BasketName", DbType.String, SchemaItemJustify.None, 250, true, false, false, false);
		public static SchemaItem CustomerName = new SchemaItem("CustomerName", DbType.String, SchemaItemJustify.None, 250, true, false, false, false);
		public static SchemaItem BasketContent = new SchemaItem("BasketContent", DbType.String, SchemaItemJustify.None, 1073741823, true, false, false, false);
		public static SchemaItem CustomerAddress = new SchemaItem("CustomerAddress", DbType.String, SchemaItemJustify.None, 250, true, false, false, false);
		public static SchemaItem CustomerTel = new SchemaItem("CustomerTel", DbType.String, SchemaItemJustify.None, 250, true, false, false, false);
		public static SchemaItem CustomerEmail = new SchemaItem("CustomerEmail", DbType.String, SchemaItemJustify.None, 250, true, false, false, false);
		public static SchemaItem Status = new SchemaItem("Status", DbType.Int32, false, true, false, false, false, false);
		public static SchemaItem DateCreated = new SchemaItem("DateCreated", DbType.Int32, false, true, false, false, false, false);
		public static SchemaItem ContactOfficeID = new SchemaItem("ContactOfficeID", DbType.Int32, false, true, false, false, false, false);

		public override ArrayList SchemaEntries
		{
			get
			{
				if (_entries == null )
				{
					_entries = new ArrayList();
					_entries.Add(BasketSchema.BasketID);
					_entries.Add(BasketSchema.BasketName);
					_entries.Add(BasketSchema.CustomerName);
					_entries.Add(BasketSchema.BasketContent);
					_entries.Add(BasketSchema.CustomerAddress);
					_entries.Add(BasketSchema.CustomerTel);
					_entries.Add(BasketSchema.CustomerEmail);
					_entries.Add(BasketSchema.Status);
					_entries.Add(BasketSchema.DateCreated);
					_entries.Add(BasketSchema.ContactOfficeID);
				}
				return _entries;
			}
		}
		
		public static bool HasAutoKey 
		{
			get { return true;	}
		}

		public static bool HasRowID 
		{
			get { return false;	}
		}
	}
	#endregion

	public abstract class _Basket : EasyObject
	{

		public _Basket()
		{
			BasketSchema _schema = new BasketSchema();
			this.SchemaEntries = _schema.SchemaEntries;
			this.SchemaGlobal = "dbo";
		}
		
		public override void FlushData() 	 
		{ 	 
			this._whereClause = null; 	 
			this._aggregateClause = null; 	 
			base.FlushData(); 	 
		}
			   
		/// <summary>
		/// Loads the business object with info from the database, based on the requested primary key.
		/// </summary>
		/// <param name="BasketID"></param>
		/// <returns>A Boolean indicating success or failure of the query</returns>
		public bool LoadByPrimaryKey(int BasketID)
		{
			switch(this.DefaultCommandType)
			{
				case CommandType.StoredProcedure:
					ListDictionary parameters = new ListDictionary();

					// Add in parameters
					parameters.Add(BasketSchema.BasketID.FieldName, BasketID);

					return base.LoadFromSql(this.SchemaStoredProcedureWithSeparator + "sp_GetBasket", parameters, CommandType.StoredProcedure);

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					this.Where.BasketID.Value = BasketID;
					return this.Query.Load();

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}
	
		/// <summary>
		/// Loads all records from the table.
		/// </summary>
		/// <returns>A Boolean indicating success or failure of the query</returns>
		public bool LoadAll()
		{
			switch(this.DefaultCommandType)
			{
				case CommandType.StoredProcedure:
					return base.LoadFromSql(this.SchemaStoredProcedureWithSeparator + "sp_GetAllBasket", null, CommandType.StoredProcedure);

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					return this.Query.Load();

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		/// <summary>
		/// Adds a new record to the internal table.
		/// </summary>
		public override void AddNew()
		{
			base.AddNew();
			this.ApplyDefaults();
		}

		/// <summary>
		/// Apply any default values to columns
		/// </summary>
		protected override void ApplyDefaults()
		{
		}

		protected override DbCommand GetInsertCommand(CommandType commandType)
		{	
			DbCommand dbCommand;

			// Create the Database object, using the default database service. The
			// default database service is determined through configuration.
			Database db = GetDatabase();

			switch(commandType)
			{
				case CommandType.StoredProcedure:
					string sqlCommand = this.SchemaStoredProcedureWithSeparator + "sp_AddBasket";
					dbCommand = db.GetStoredProcCommand(sqlCommand);

					db.AddParameter(dbCommand, "BasketID", DbType.Int32, 0, ParameterDirection.Output, true, 0, 0, "BasketID", DataRowVersion.Default, Convert.DBNull);
					CreateParameters(db, dbCommand);
					
					return dbCommand;

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					foreach(SchemaItem item in this.SchemaEntries)
					{
						if (!item.IsComputed)
						{
							if ((item.IsAutoKey && this.IdentityInsert) || !item.IsAutoKey)
							{
								this.Query.AddInsertColumn(item);
							}
						}
					}
					dbCommand = this.Query.GetInsertCommandWrapper();

					dbCommand.Parameters.Clear();
					if (this.IdentityInsert)
					{
						db.AddInParameter(dbCommand, "BasketID", DbType.Int32, "BasketID", DataRowVersion.Default);
					}
					else
					{
						db.AddParameter(dbCommand, "BasketID", DbType.Int32, 0, ParameterDirection.Output, true, 0, 0, "BasketID", DataRowVersion.Default, Convert.DBNull);
					}
					CreateParameters(db, dbCommand);

					return dbCommand;

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		protected override DbCommand GetUpdateCommand(CommandType commandType)
		{
            DbCommand dbCommand;

			// Create the Database object, using the default database service. The
			// default database service is determined through configuration.
			Database db = GetDatabase();

			switch(commandType)
			{
				case CommandType.StoredProcedure:
					string sqlCommand = this.SchemaStoredProcedureWithSeparator + "sp_UpdateBasket";
					dbCommand = db.GetStoredProcCommand(sqlCommand);

					db.AddInParameter(dbCommand, "BasketID", DbType.Int32, "BasketID", DataRowVersion.Current);
					CreateParameters(db, dbCommand);
					
					return dbCommand;

				case CommandType.Text:
					this.Query.ClearAll();
					foreach(SchemaItem item in this.SchemaEntries)
					{
						if (!(item.IsAutoKey || item.IsComputed))
						{
							this.Query.AddUpdateColumn(item);
						}
					}

					this.Where.WhereClauseReset();
					this.Where.BasketID.Operator = WhereParameter.Operand.Equal;
					dbCommand = this.Query.GetUpdateCommandWrapper();

					dbCommand.Parameters.Clear();
					CreateParameters(db, dbCommand);
					db.AddInParameter(dbCommand, "BasketID", DbType.Int32, "BasketID", DataRowVersion.Current);
					
					return dbCommand;

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		protected override DbCommand GetDeleteCommand(CommandType commandType)
		{
            DbCommand dbCommand;

			// Create the Database object, using the default database service. The
			// default database service is determined through configuration.
			Database db = GetDatabase();

			switch(commandType)
			{
				case CommandType.StoredProcedure:
					string sqlCommand = this.SchemaStoredProcedureWithSeparator + "sp_DeleteBasket";
					dbCommand = db.GetStoredProcCommand(sqlCommand);
					db.AddInParameter(dbCommand, "BasketID", DbType.Int32, "BasketID", DataRowVersion.Current);
					
					return dbCommand;

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					this.Where.BasketID.Operator = WhereParameter.Operand.Equal;
					dbCommand = this.Query.GetDeleteCommandWrapper();

					dbCommand.Parameters.Clear();
					db.AddInParameter(dbCommand, "BasketID", DbType.Int32, "BasketID", DataRowVersion.Current);
					
					return dbCommand;

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		private void CreateParameters(Database db, DbCommand dbCommand)
		{
			db.AddInParameter(dbCommand, "BasketName", DbType.String, "BasketName", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "CustomerName", DbType.String, "CustomerName", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "BasketContent", DbType.String, "BasketContent", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "CustomerAddress", DbType.String, "CustomerAddress", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "CustomerTel", DbType.String, "CustomerTel", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "CustomerEmail", DbType.String, "CustomerEmail", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "Status", DbType.Int32, "Status", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "DateCreated", DbType.Int32, "DateCreated", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "ContactOfficeID", DbType.Int32, "ContactOfficeID", DataRowVersion.Current);
		}
		
		#region Properties
		public virtual int BasketID
		{
			get
			{
				return this.GetInteger(BasketSchema.BasketID.FieldName);
	    	}
			set
			{
				this.SetInteger(BasketSchema.BasketID.FieldName, value);
			}
		}
		public virtual string BasketName
		{
			get
			{
				return this.GetString(BasketSchema.BasketName.FieldName);
	    	}
			set
			{
				this.SetString(BasketSchema.BasketName.FieldName, value);
			}
		}
		public virtual string CustomerName
		{
			get
			{
				return this.GetString(BasketSchema.CustomerName.FieldName);
	    	}
			set
			{
				this.SetString(BasketSchema.CustomerName.FieldName, value);
			}
		}
		public virtual string BasketContent
		{
			get
			{
				return this.GetString(BasketSchema.BasketContent.FieldName);
	    	}
			set
			{
				this.SetString(BasketSchema.BasketContent.FieldName, value);
			}
		}
		public virtual string CustomerAddress
		{
			get
			{
				return this.GetString(BasketSchema.CustomerAddress.FieldName);
	    	}
			set
			{
				this.SetString(BasketSchema.CustomerAddress.FieldName, value);
			}
		}
		public virtual string CustomerTel
		{
			get
			{
				return this.GetString(BasketSchema.CustomerTel.FieldName);
	    	}
			set
			{
				this.SetString(BasketSchema.CustomerTel.FieldName, value);
			}
		}
		public virtual string CustomerEmail
		{
			get
			{
				return this.GetString(BasketSchema.CustomerEmail.FieldName);
	    	}
			set
			{
				this.SetString(BasketSchema.CustomerEmail.FieldName, value);
			}
		}
		public virtual int Status
		{
			get
			{
				return this.GetInteger(BasketSchema.Status.FieldName);
	    	}
			set
			{
				this.SetInteger(BasketSchema.Status.FieldName, value);
			}
		}
		public virtual int DateCreated
		{
			get
			{
				return this.GetInteger(BasketSchema.DateCreated.FieldName);
	    	}
			set
			{
				this.SetInteger(BasketSchema.DateCreated.FieldName, value);
			}
		}
		public virtual int ContactOfficeID
		{
			get
			{
				return this.GetInteger(BasketSchema.ContactOfficeID.FieldName);
	    	}
			set
			{
				this.SetInteger(BasketSchema.ContactOfficeID.FieldName, value);
			}
		}

		public override string TableName
		{
			get { return "Basket"; }
		}
		
		#endregion		
		
		#region String Properties
		public virtual string s_BasketID
		{
			get
			{
			    return this.IsColumnNull(BasketSchema.BasketID.FieldName) ? string.Empty : base.GetIntegerAsString(BasketSchema.BasketID.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(BasketSchema.BasketID.FieldName);
			    else
			        this.BasketID = base.SetIntegerAsString(BasketSchema.BasketID.FieldName, value);
			}
		}
		public virtual string s_BasketName
		{
			get
			{
			    return this.IsColumnNull(BasketSchema.BasketName.FieldName) ? string.Empty : base.GetStringAsString(BasketSchema.BasketName.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(BasketSchema.BasketName.FieldName);
			    else
			        this.BasketName = base.SetStringAsString(BasketSchema.BasketName.FieldName, value);
			}
		}
		public virtual string s_CustomerName
		{
			get
			{
			    return this.IsColumnNull(BasketSchema.CustomerName.FieldName) ? string.Empty : base.GetStringAsString(BasketSchema.CustomerName.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(BasketSchema.CustomerName.FieldName);
			    else
			        this.CustomerName = base.SetStringAsString(BasketSchema.CustomerName.FieldName, value);
			}
		}
		public virtual string s_BasketContent
		{
			get
			{
			    return this.IsColumnNull(BasketSchema.BasketContent.FieldName) ? string.Empty : base.GetStringAsString(BasketSchema.BasketContent.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(BasketSchema.BasketContent.FieldName);
			    else
			        this.BasketContent = base.SetStringAsString(BasketSchema.BasketContent.FieldName, value);
			}
		}
		public virtual string s_CustomerAddress
		{
			get
			{
			    return this.IsColumnNull(BasketSchema.CustomerAddress.FieldName) ? string.Empty : base.GetStringAsString(BasketSchema.CustomerAddress.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(BasketSchema.CustomerAddress.FieldName);
			    else
			        this.CustomerAddress = base.SetStringAsString(BasketSchema.CustomerAddress.FieldName, value);
			}
		}
		public virtual string s_CustomerTel
		{
			get
			{
			    return this.IsColumnNull(BasketSchema.CustomerTel.FieldName) ? string.Empty : base.GetStringAsString(BasketSchema.CustomerTel.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(BasketSchema.CustomerTel.FieldName);
			    else
			        this.CustomerTel = base.SetStringAsString(BasketSchema.CustomerTel.FieldName, value);
			}
		}
		public virtual string s_CustomerEmail
		{
			get
			{
			    return this.IsColumnNull(BasketSchema.CustomerEmail.FieldName) ? string.Empty : base.GetStringAsString(BasketSchema.CustomerEmail.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(BasketSchema.CustomerEmail.FieldName);
			    else
			        this.CustomerEmail = base.SetStringAsString(BasketSchema.CustomerEmail.FieldName, value);
			}
		}
		public virtual string s_Status
		{
			get
			{
			    return this.IsColumnNull(BasketSchema.Status.FieldName) ? string.Empty : base.GetIntegerAsString(BasketSchema.Status.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(BasketSchema.Status.FieldName);
			    else
			        this.Status = base.SetIntegerAsString(BasketSchema.Status.FieldName, value);
			}
		}
		public virtual string s_DateCreated
		{
			get
			{
			    return this.IsColumnNull(BasketSchema.DateCreated.FieldName) ? string.Empty : base.GetIntegerAsString(BasketSchema.DateCreated.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(BasketSchema.DateCreated.FieldName);
			    else
			        this.DateCreated = base.SetIntegerAsString(BasketSchema.DateCreated.FieldName, value);
			}
		}
		public virtual string s_ContactOfficeID
		{
			get
			{
			    return this.IsColumnNull(BasketSchema.ContactOfficeID.FieldName) ? string.Empty : base.GetIntegerAsString(BasketSchema.ContactOfficeID.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(BasketSchema.ContactOfficeID.FieldName);
			    else
			        this.ContactOfficeID = base.SetIntegerAsString(BasketSchema.ContactOfficeID.FieldName, value);
			}
		}
		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(EasyObject entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter BasketID
				{
					get
					{
							WhereParameter wp = new WhereParameter(BasketSchema.BasketID);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter BasketName
				{
					get
					{
							WhereParameter wp = new WhereParameter(BasketSchema.BasketName);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter CustomerName
				{
					get
					{
							WhereParameter wp = new WhereParameter(BasketSchema.CustomerName);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter BasketContent
				{
					get
					{
							WhereParameter wp = new WhereParameter(BasketSchema.BasketContent);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter CustomerAddress
				{
					get
					{
							WhereParameter wp = new WhereParameter(BasketSchema.CustomerAddress);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter CustomerTel
				{
					get
					{
							WhereParameter wp = new WhereParameter(BasketSchema.CustomerTel);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter CustomerEmail
				{
					get
					{
							WhereParameter wp = new WhereParameter(BasketSchema.CustomerEmail);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter Status
				{
					get
					{
							WhereParameter wp = new WhereParameter(BasketSchema.Status);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter DateCreated
				{
					get
					{
							WhereParameter wp = new WhereParameter(BasketSchema.DateCreated);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter ContactOfficeID
				{
					get
					{
							WhereParameter wp = new WhereParameter(BasketSchema.ContactOfficeID);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter BasketID
		    {
				get
		        {
					if(_BasketID_W == null)
	        	    {
						_BasketID_W = TearOff.BasketID;
					}
					return _BasketID_W;
				}
			}

			public WhereParameter BasketName
		    {
				get
		        {
					if(_BasketName_W == null)
	        	    {
						_BasketName_W = TearOff.BasketName;
					}
					return _BasketName_W;
				}
			}

			public WhereParameter CustomerName
		    {
				get
		        {
					if(_CustomerName_W == null)
	        	    {
						_CustomerName_W = TearOff.CustomerName;
					}
					return _CustomerName_W;
				}
			}

			public WhereParameter BasketContent
		    {
				get
		        {
					if(_BasketContent_W == null)
	        	    {
						_BasketContent_W = TearOff.BasketContent;
					}
					return _BasketContent_W;
				}
			}

			public WhereParameter CustomerAddress
		    {
				get
		        {
					if(_CustomerAddress_W == null)
	        	    {
						_CustomerAddress_W = TearOff.CustomerAddress;
					}
					return _CustomerAddress_W;
				}
			}

			public WhereParameter CustomerTel
		    {
				get
		        {
					if(_CustomerTel_W == null)
	        	    {
						_CustomerTel_W = TearOff.CustomerTel;
					}
					return _CustomerTel_W;
				}
			}

			public WhereParameter CustomerEmail
		    {
				get
		        {
					if(_CustomerEmail_W == null)
	        	    {
						_CustomerEmail_W = TearOff.CustomerEmail;
					}
					return _CustomerEmail_W;
				}
			}

			public WhereParameter Status
		    {
				get
		        {
					if(_Status_W == null)
	        	    {
						_Status_W = TearOff.Status;
					}
					return _Status_W;
				}
			}

			public WhereParameter DateCreated
		    {
				get
		        {
					if(_DateCreated_W == null)
	        	    {
						_DateCreated_W = TearOff.DateCreated;
					}
					return _DateCreated_W;
				}
			}

			public WhereParameter ContactOfficeID
		    {
				get
		        {
					if(_ContactOfficeID_W == null)
	        	    {
						_ContactOfficeID_W = TearOff.ContactOfficeID;
					}
					return _ContactOfficeID_W;
				}
			}

			private WhereParameter _BasketID_W = null;
			private WhereParameter _BasketName_W = null;
			private WhereParameter _CustomerName_W = null;
			private WhereParameter _BasketContent_W = null;
			private WhereParameter _CustomerAddress_W = null;
			private WhereParameter _CustomerTel_W = null;
			private WhereParameter _CustomerEmail_W = null;
			private WhereParameter _Status_W = null;
			private WhereParameter _DateCreated_W = null;
			private WhereParameter _ContactOfficeID_W = null;

			public void WhereClauseReset()
			{
				_BasketID_W = null;
				_BasketName_W = null;
				_CustomerName_W = null;
				_BasketContent_W = null;
				_CustomerAddress_W = null;
				_CustomerTel_W = null;
				_CustomerEmail_W = null;
				_Status_W = null;
				_DateCreated_W = null;
				_ContactOfficeID_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private EasyObject _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
		
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(EasyObject entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter BasketID
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(BasketSchema.BasketID);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter BasketName
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(BasketSchema.BasketName);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter CustomerName
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(BasketSchema.CustomerName);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter BasketContent
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(BasketSchema.BasketContent);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter CustomerAddress
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(BasketSchema.CustomerAddress);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter CustomerTel
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(BasketSchema.CustomerTel);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter CustomerEmail
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(BasketSchema.CustomerEmail);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter Status
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(BasketSchema.Status);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter DateCreated
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(BasketSchema.DateCreated);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter ContactOfficeID
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(BasketSchema.ContactOfficeID);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter BasketID
		    {
				get
		        {
					if(_BasketID_W == null)
	        	    {
						_BasketID_W = TearOff.BasketID;
					}
					return _BasketID_W;
				}
			}

			public AggregateParameter BasketName
		    {
				get
		        {
					if(_BasketName_W == null)
	        	    {
						_BasketName_W = TearOff.BasketName;
					}
					return _BasketName_W;
				}
			}

			public AggregateParameter CustomerName
		    {
				get
		        {
					if(_CustomerName_W == null)
	        	    {
						_CustomerName_W = TearOff.CustomerName;
					}
					return _CustomerName_W;
				}
			}

			public AggregateParameter BasketContent
		    {
				get
		        {
					if(_BasketContent_W == null)
	        	    {
						_BasketContent_W = TearOff.BasketContent;
					}
					return _BasketContent_W;
				}
			}

			public AggregateParameter CustomerAddress
		    {
				get
		        {
					if(_CustomerAddress_W == null)
	        	    {
						_CustomerAddress_W = TearOff.CustomerAddress;
					}
					return _CustomerAddress_W;
				}
			}

			public AggregateParameter CustomerTel
		    {
				get
		        {
					if(_CustomerTel_W == null)
	        	    {
						_CustomerTel_W = TearOff.CustomerTel;
					}
					return _CustomerTel_W;
				}
			}

			public AggregateParameter CustomerEmail
		    {
				get
		        {
					if(_CustomerEmail_W == null)
	        	    {
						_CustomerEmail_W = TearOff.CustomerEmail;
					}
					return _CustomerEmail_W;
				}
			}

			public AggregateParameter Status
		    {
				get
		        {
					if(_Status_W == null)
	        	    {
						_Status_W = TearOff.Status;
					}
					return _Status_W;
				}
			}

			public AggregateParameter DateCreated
		    {
				get
		        {
					if(_DateCreated_W == null)
	        	    {
						_DateCreated_W = TearOff.DateCreated;
					}
					return _DateCreated_W;
				}
			}

			public AggregateParameter ContactOfficeID
		    {
				get
		        {
					if(_ContactOfficeID_W == null)
	        	    {
						_ContactOfficeID_W = TearOff.ContactOfficeID;
					}
					return _ContactOfficeID_W;
				}
			}

			private AggregateParameter _BasketID_W = null;
			private AggregateParameter _BasketName_W = null;
			private AggregateParameter _CustomerName_W = null;
			private AggregateParameter _BasketContent_W = null;
			private AggregateParameter _CustomerAddress_W = null;
			private AggregateParameter _CustomerTel_W = null;
			private AggregateParameter _CustomerEmail_W = null;
			private AggregateParameter _Status_W = null;
			private AggregateParameter _DateCreated_W = null;
			private AggregateParameter _ContactOfficeID_W = null;

			public void AggregateClauseReset()
			{
				_BasketID_W = null;
				_BasketName_W = null;
				_CustomerName_W = null;
				_BasketContent_W = null;
				_CustomerAddress_W = null;
				_CustomerTel_W = null;
				_CustomerEmail_W = null;
				_Status_W = null;
				_DateCreated_W = null;
				_ContactOfficeID_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private EasyObject _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	}
}
